﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Script.Serialization;
using MinistryStandardPlatformWeb.Models.ReportCenter;

namespace MinistryStandardPlatformWeb.Controllers.Reports
{
    [MenuAuthorized("42")]
    public class IllegalWorkController : Controller
    {
        //
        // GET: /IllegalWork/

        public ActionResult Index(string startTime, string endTime)
        {
            ViewBag.startTime = startTime;
            ViewBag.endTime = endTime;
            return View();
        }

        [HttpPost]
        public ActionResult GetData(string startTime, string endTime, string vehicles)
        {
            List<IllegalWork> list = new List<IllegalWork>();
            string[] vehicleList = vehicles.Split(';');
            for (int i = 0; i < 35; i++)
            {
                IllegalWork item = new IllegalWork();
                item.mVehicleName = vehicleList[0];
                item.mDepart = startTime;
                item.mLeaveStationTime = endTime;
                list.Add(item);
            }
            var json = new
            {
                total = list.Count,
                rows = list
            };
            var serializer = new JavaScriptSerializer();
            serializer.MaxJsonLength = Int32.MaxValue;
            return Content(serializer.Serialize(json), "application/json");
        }
    }
}
